package com.qf.ucenter.service.impl;

import com.qf.ucenter.entity.User;
import com.qf.ucenter.service.IUserService;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements IUserService {


    @Override
    public User login(User user) {
        //todo 根据用户名查询用户
        User dbUser = new User();
        dbUser.setPassword("123456");
        //查询用户名不存在
        if (dbUser == null) {
            //用户不存在
            throw new RuntimeException("用户名不存在");
        }
        //判断用户密码是否匹配
        if (!user.getPassword().equals(dbUser.getPassword())) {
            //密码不正确
            throw new RuntimeException("密码不正确");
        }
        return dbUser;
    }
}
